import axios from 'axios';
// axios提供的拦截器interceptor
// 拦截请求
axios.interceptors.request.use( config => {
    config.headers['Authorization'] = 'bearer '+ localStorage.getItem("token");
    return config;
});
// 拦截响应
axios.interceptors.response.use(response => {
    return response;
},error => {
    if(error.response.status == 401){
        window.location = "/login";
    }
    return Promise.reject(error.response.data);
})

export {axios};
export const url = "";